public class Login {
    private String userName = "admin";
    private String password = "123456";

    public static void loginInFo(String userName, String password) throws UserNameException, PasswordException {
        if (!userName.equals(userName)) {
            throw new UserNameException("用户名有问题");
        }
        if (!password.equals(password)) {
            throw new PasswordException("密码有问题");
        }
        System.out.println("登陆成功");
    }

    public static void main(String[] args) throws UserNameException, PasswordException {
        try {
            loginInFo("admin", "123456");
        } catch (UserNameException e) {

        } catch (PasswordException e) {

        } finally {

        }


    }
}
class PasswordException extends Exception{
    public PasswordException(String message){
        super(message);
    }
}
    class UserNameException extends Exception{
public UserNameException(String message){
        super(message);
        }
        }